
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<head>
<title>Market place</title>
</head>

<body>
	<ui:composition>

		<p:panel id="loginPanel" styleClass="loginPanel" header="#{msgs.pleaseLogin}" toggleable="true" collapsed="true"
			rendered="#{userModel.authenticatedUser == null}" style="width:100%">
			<p:tabView effect="slide" effectDuration="2000" orientation="bottom">
				<p:tab title="#{msgs.email}">
					<h:panelGrid border="0" columns="2" style="width:100%">
						<h:outputLabel style="float:left" value="#{msgs.email}" />
						<p:inputText autocomplete="true" id="qf_email" value="#{userModel.current.email}"  />
						<h:outputLabel value="#{msgs.password}" style="float:left;" />
						<p:password id="qf_password" value="#{userModel.current.password}"
							feedback="false" />
					</h:panelGrid>
					<h:panelGrid border="0" columns="2" style="width:100%">
						<p:commandButton value="#{msgs.login}" ajax="true"
							update=":centerForm,:rightForm,:headerForm,:footerForm"
							actionListener="#{userController.loginCurrentByEmail}"
							style="float:left" />
						<h:panelGrid columns="2" style="width:100%">
							<h:commandLink value="#{msgs.notMember}" type="submit"
								style="float:left" immediate="true"
								action="/public/register.xhtml?faces-redirect=true" />
							<h:commandLink value="#{msgs.forgetPassword}" type="submit"
								style="float:left" immediate="true"
								action="/public/passwordRecover.xhtml?faces-redirect=true" />
						</h:panelGrid>
					</h:panelGrid>
				</p:tab>
				<p:tab title="#{msgs.telephone}">
					<h:panelGrid  border="0" columns="2" style="width:100%"  >
						<h:outputLabel style="float:left" value="#{msgs.telephone}" />
						<p:inputMask id="qf_telephone" value="#{userModel.current.telephone}"
							mask="(999)999-9999"  ></p:inputMask>
						<h:outputLabel value="#{msgs.password}" style="float:left;" />
						<p:password id="qf_telephonePassword" feedback="false"
							value="#{userModel.current.confirmPassword}" />
					</h:panelGrid>
					<h:panelGrid border="0" columns="2" style="width:100%">
						<p:commandButton value="#{msgs.login}" ajax="true"
							update=":centerForm,:rightForm,:headerForm,:footerForm,"
							actionListener="#{userController.loginCurrentByTelephone}"
							style="float:left" />
						<h:panelGrid columns="2" style="width:100%">
							<h:commandLink value="#{msgs.notMember}" type="submit"
								style="float:left" immediate="true"
								action="/public/register.xhtml?faces-redirect=true" />
							<h:commandLink value="#{msgs.forgetPassword}" type="submit"
								style="float:left" immediate="true"
								action="/public/register.xhtml?faces-redirect=true" />
						</h:panelGrid>
					</h:panelGrid>
				</p:tab>
			</p:tabView>
		</p:panel>

		<p:panel
			header="#{msgs.welcome}  #{userModel.authenticatedUser.lastName} #{userModel.authenticatedUser.firstName}"
			toggleable="true" rendered="#{userModel.authenticatedUser != null}"
			style="width:100%">
			<h:panelGrid border="0" columns="2" style="width:100%">
				<h:outputLabel style="float:left" value="#{msgs.myBalance}:" />
				<h:outputText value="#{userModel.authenticatedUser.balance}"
					style="float:right">
					<f:convertNumber type="currency" currencySymbol="$" minFractionDigits="2" maxFractionDigits="2"></f:convertNumber>
				</h:outputText>
				<p:commandLink value="#{msgs.myOrders}" action="/user/myOrders.xhtml?faces-redirect=true"></p:commandLink>
				<p:commandLink value="#{msgs.myInfo}" action="/user/myInfo.xhtml?faces-redirect=true" style="float:right" ></p:commandLink>
				<p:commandButton value="#{msgs.logOut}" ajax="true" immediate="true"
					update=":centerForm,:rightForm,:headerForm"
					actionListener="#{userController.logOutCurrent}"
					style="float:left;padding:0px;margin:0px" />
				
				<p:commandLink value="#{msgs.changePassword}" action="/user/changePassword.xhtml?faces-redirect=true" style="float:right">
				</p:commandLink>
			</h:panelGrid>
		</p:panel>
	</ui:composition>
</body>

</html>


